@import '../core/theming/theming';
@import '../core/theming/check-duplicate-styles';

@mixin mat-icon-color($config-or-theme) {
  $config: mat-get-color-config($config-or-theme);
  $primary: map-get($config, primary);
  $accent: map-get($config, accent);
  $warn: map-get($config, warn);
  $background: map-get($config, background);
  $foreground: map-get($config, foreground);

  .mat-icon {
    &.mat-primary {
      color: mat-color($primary, text);
    }

    &.mat-accent {
      color: mat-color($accent, text);
    }

    &.mat-warn {
      color: mat-color($warn, text);
    }
  }
}

@mixin mat-icon-typography($config-or-theme) {}

@mixin _mat-icon-density($config-or-theme) {}

@mixin mat-icon-theme($theme-or-color-config) {
  $theme: _mat-legacy-get-theme($theme-or-color-config);
  @include _mat-check-duplicate-theme-styles($theme, 'mat-icon') {
    $color: mat-get-color-config($theme);
    $density: mat-get-density-config($theme);
    $typography: mat-get-typography-config($theme);

    @if $color != null {
      @include mat-icon-color($color);
    }
    @if $density != null {
      @include _mat-icon-density($density);
    }
    @if $typography != null {
      @include mat-icon-typography($typography);
    }
  }
}

